import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolApp {
    public static void main(String[] args) {
        ExecutorService ex = new ThreadPoolExecutor(10,20,30L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>(50),
                new ThreadPoolExecutor.CallerRunsPolicy());
        System.out.println("Thread ID " + Thread.currentThread().getId());
        for (int i = 0; i < 99; i++) {
            ex.submit(new ThreadPool(i));
        }
    }
}
